namespace Valil.Chess
{
    /// <summary>
    /// Helper class, keeps the string descriptions of a move.
    /// </summary>
    public class MoveStringDescription
    {
        /// <summary>
        /// The index representation of the move.
        /// </summary>
        private string index;

        /// <summary>
        /// The index representation of the move.
        /// </summary>
        public string Index
        {
            get { return index; }
        }

        /// <summary>
        /// The move SAN.
        /// </summary>
        private string san;

        /// <summary>
        /// The move SAN.
        /// </summary>
        public string SAN
        {
            get { return san; }
        }

        /// <summary>
        /// The index and the SAN of the move.
        /// </summary>
        private string indexedSAN;

        /// <summary>
        /// True if this is a white move, false otherwise.
        /// </summary>
        public bool IsWhiteMove
        {
            get { return !Index.EndsWith("..."); }
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="index"></param>
        /// <param name="SAN"></param>
        internal MoveStringDescription(string index, string SAN)
        {
            this.index = index;
            this.san = SAN;
            indexedSAN = index + ' ' + SAN;
        }

        /// <summary>
        /// The index and the SAN of the move.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return indexedSAN;
        }

    }
}
